package com.mceil.mceilbase.activity;

import android.content.Intent;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;
import com.kongzue.dialogx.DialogX;
import com.kongzue.dialogx.dialogs.InputDialog;
import com.kongzue.dialogx.dialogs.MessageDialog;
import com.kongzue.dialogx.interfaces.OnDialogButtonClickListener;
import com.mceil.mceilbase.R;
import com.mceil.mceilbase.adapter.DaliyDetialAdpater;
import com.mceil.mceilbase.bean.DaliyDetialBean;
import com.mceil.mylibrary.annotation.ContentView;
import com.mceil.mylibrary.annotation.ViewInject;
import com.mceil.mylibrary.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import es.dmoral.toasty.Toasty;

@ContentView(R.layout.activity_daliy_detial)
public class DaliyDetialActivity extends BaseActivity {
    @ViewInject(R.id.toolbar)
    TitleBar toolBar;

    @ViewInject(R.id.recycler_view)
    RecyclerView recyclerView;

    @Override
    protected void initPreferences() {
        toolBar.setTitle("2023年12月12日");
        toolBar.setRightTitle("新增");
        toolBar.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(TitleBar titleBar) {
                finish();
            }

            @Override
            public void onTitleClick(TitleBar titleBar) {
                OnTitleBarListener.super.onTitleClick(titleBar);
            }

            @Override
            public void onRightClick(TitleBar titleBar) {
                Intent intent = new Intent(DaliyDetialActivity.this, AddRecordsActivity.class);
                startActivity(intent);
            }
        });
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        List<DaliyDetialBean> mDatas = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            mDatas.add(new DaliyDetialBean());
        }
        initList(mDatas);
    }

    private void initList(List<DaliyDetialBean> mDatas) {
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        DaliyDetialAdpater adpater = new DaliyDetialAdpater(R.layout.item_daliy_detial, mDatas);
        recyclerView.setAdapter(adpater);
        adpater.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {

            }
        });
    }


}
